package regpang.myapplication22;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import regpang.listviewtest.RecyclerMainActivity;
import regpang.myapplication22.DatePicker.DatePickerActivity;
import regpang.myapplication22.ShowMoreText.ShowMoreTextActivity;
import regpang.myapplication22.ViscosityControl.ViscosityControlActivity;
import regpang.myapplication22.WaterWaveView.WaterWaveViewActivity;
import regpang.myapplication22.animotion.AnimationToViewActivity;
import regpang.myapplication22.dialog.DialogShowActivity;
import regpang.myapplication22.editText.EditTextDemoActivity;
import regpang.myapplication22.foldtoolbar.FoldToolbarActivity;
import regpang.myapplication22.image.ImageToolsActivity;
import regpang.myapplication22.musicplayer.MusicPlayerActivity;
import regpang.myapplication22.statistical.StatisticalActivity;
import regpang.myapplication22.viewPager.ViewPagerAniMainActivity;

public class MainActivity extends AppCompatActivity {

    private List<String> items;
    private List<Class> activities = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        addActivitys();
        String[] stringArray = getResources().getStringArray(R.array.item_name);
        items = Arrays.asList(stringArray);
        ListView listView = (ListView) findViewById(R.id.lv_list);
        listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items));
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                System.out.print("MainList  position:" + position + " id:" + id);
                startActivity(new Intent(MainActivity.this, activities.get(position)));
            }
        });
    }

    /**
     * 添加待跳转的Activity
     */
    private void addActivitys() {
        //限制输入表情的输入框
        activities.add(EditTextDemoActivity.class);
        //自定义圆形水波纹
        activities.add(WaterWaveViewActivity.class);
        //ViewPager侧滑动画
        activities.add(ViewPagerAniMainActivity.class);
        //音乐播放器
        activities.add(MusicPlayerActivity.class);
        //拖拽式粘性控件
        activities.add(ViscosityControlActivity.class);
        //图像饱和度处理
        activities.add(ImageToolsActivity.class);
        //可折叠的文字显示
        activities.add(ShowMoreTextActivity.class);
        //蜘蛛网雷达图统计图
        activities.add(StatisticalActivity.class);
        //滚轮时间选择器
        activities.add(DatePickerActivity.class);
        //视图隐藏显示增加动画
        activities.add(AnimationToViewActivity.class);
        //DialogFragment的使用
        activities.add(DialogShowActivity.class);
        //RecyclerView的使用示例
        activities.add(RecyclerMainActivity.class);
        //折叠式状态栏布局
        activities.add(FoldToolbarActivity.class);
    }
}
